WebSocketLinks

The links of site over WebSockets, to sites on any platform (JVM, Node.js, browsers): the links it accepts once it listens (on Node.js, through the package ws), and those it opens (connect, with the WebSocket of the runtime). Each frame is a text message; those of a link arrive in order.

Constructors

Link copied to clipboard
constructor(site: LinkListener)

Functions

Link copied to clipboard
fun close()

Closes every link, and stops listening

Link copied to clipboard
fun connect(url: String, code: String? = null, opening: (Link) -> Unit = {}): Promise<Unit>

Opens a link to the site listening at url (ws://host:port): code presented if given (see Site.requiresCode), and the link given to opening before it opens

Link copied to clipboard
fun listen(port: Int = 0, host: String = "0.0.0.0"): Promise<Int>

Accepts the links of other sites on port of host (an ephemeral port for 0), on Node.js: the port taken